<?php
/**
 * 优惠券内容表
 *
 * @author Zeon <scplay@gmail.com>
 * @date 2019/5/7
 * @copyright PanxSoft Inc.
 */
namespace App\Models\Coupon;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;

/**
 * Class CouponCard
 *
 * @property float probability
 * @property int expired_in
 * @property int is_available
 * @property int customer_id
 *
 * @package App\Models\Coupon
 *
 * @mixin Builder
 * @mixin \Illuminate\Database\Query\Builder
 */
class CouponTicket extends Model
{
    protected $table = 'coupon_tickets';
    protected static $unguarded = true;

    const IS_AVAILABLE = 1;

    const DISCOUNT_TYPE_NUM = 1;
    const DISCOUNT_TYPE_PERCENTAGE = 2;

    const EXPIRE_TYPE_RANGE = 1; // 以 started_at 到 ended_at 固定时间
    const EXPIRE_TYPE_PRESENT = 2; // 从抽奖成功时 + expired_in 时间为起止日期

    protected $casts = [
        'customer_id'  => 'int',
        'is_available' => 'int',
        'expired_in' => 'int',
        'probability'  => 'float',
    ];
}